﻿using System;
using System.Data;
using System.Collections.Generic;
using ZHDJ.MobileInterface.Common;

namespace ZHDJ.MobileInterface
{
    public partial class GetLawCallMassage : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            GetLawCallMassageOutParam result = new GetLawCallMassageOutParam();
            GetLawCallMassageInParam param = new GetLawCallMassageInParam();
            string logMsg = "";
            bool isFlag = true;

            try
            {
                param = inParam as GetLawCallMassageInParam;


                if (isFlag)
                {
                   DataTable dt=SXT.Party.Law.BLL.CommonUtils.GetLawCallMassage("MobileService").Tables[0];
                   foreach (DataRow dr in dt.Rows)
                   {
                       LawCallMassage mass = new LawCallMassage();
                       mass.LoginID = dr["LoginID"].ToString();
                       mass.PhoneNo = dr["PhoneNo"].ToString();
                       mass.UserName = dr["UserName"].ToString();
                       mass.CreateTime = Convert.ToDateTime(dr["CreateTime"]).ToString("yyyy-MM-dd HH:mm:ss");
                       result.CallMassage.Add(mass);
                   }
                }

                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作异常，多次出现请联系管理员";
                logMsg = ex.Message + ":" + ex.StackTrace;
            }

            CommonUtils.InsertMobileInterfaceLog(SystemCode + "-GetLawKnowledge", SerializeHelper.JsonSerializer<GetLawCallMassageInParam>(param), logMsg);
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<GetLawCallMassageInParam, GetLawCallMassageOutParam>();
            else
                SafeProcessRequest<GetLawCallMassageInParam, GetLawCallMassageOutParam>();
        }

       
    }

    #region 请求参数
    public class GetLawCallMassageInParam
    {
        /// <summary>
        /// 必填 当前页
        /// </summary>
        public string Type
        { get; set; }

    }
    #endregion


    #region 结果参数
    public class GetLawCallMassageOutParam
    {
        public GetLawCallMassageOutParam()
        {
            code = "1";
            desc = "操作成功";
            CallMassage=new List<LawCallMassage>();
        }

        public string code
        { get; set; }

        public string desc
        { get; set; }
        public List<LawCallMassage> CallMassage { get; set; }
        
    }

    public class LawCallMassage
    {
        public string LoginID { get; set; }
        public string UserName { get; set; }
        public string PhoneNo { get; set; }
        public string CreateTime { get; set; }
    }
    #endregion
}